home *** CD-ROM | disk | FTP | other *** search
/ US Department of Defenseā€¦ndamentals 1.0 2004 April / US Department of Defense: Firewall & Router Fundamentals 1.0 2004 April.iso / text_only / includes / course_map.js < prev    next >
Text File  |  2003-12-08  |  4KB  |  103 lines

  1. //get the API WINDOW, make sure it is open
  2. if (opener.API_WIN == null) {
  3.   if (opener.opener.API_WIN == null)  {
  4.     alert("The LMS Tracking Window is no longer open.\nThis training requires this window be open.\nPlease re-run this training object...");
  5.     window.close();
  6.   }
  7.   else
  8.     var API_WIN = opener.opener.API_WIN;
  9. }
  10. else  {
  11.   var API_WIN = opener.API_WIN;   
  12. }
  13.  
  14. //get SCO window
  15. if (API_WIN.CONTENT_WIN.SCO_WIN == null)   {
  16.   alert("The Course Window is no longer open.\nThis training requires this window be open.\nPlease re-run the training object...");
  17.   window.close();
  18. }
  19. else  {
  20.   var SCO_WIN = API_WIN.CONTENT_WIN.SCO_WIN;
  21. }
  22.   
  23. var CUR_SCO = API_WIN.CUR_SCO;
  24. var CUR_PAGE = SCO_WIN.CUR_PAGE;
  25. var SCO_COMPLETE = false;
  26. if ((API_WIN.SCORM_INITIALIZED) || (API_WIN.FILE_LMS)) {
  27.   if ((API_WIN.SCO_STATUS == "c") || (API_WIN.SCO_STATUS == "p"))
  28.     SCO_COMPLETE = true;
  29. }
  30. else  {
  31.   SCO_COMPLETE = true;
  32. }
  33.  
  34. function load_topic(page_num)
  35. {
  36.   SCO_WIN.goto_page(page_num);
  37.   window.close();
  38. }
  39.  
  40. function write_course_map()
  41. {
  42.   var list_html = "";
  43.   
  44.   //write top html
  45.   list_html += "<TABLE width=100% cellpadding=0 cellspacing=0><TR><TD valign=top width='20'><IMG SRC='../images/course_map/1a.gif' width=20 height=21></TD><TD valign=top width='100%' background='../images/course_map/tbl_bkgrnd.gif'><IMG SRC='../images/course_map/1b.gif' width=30 height=21></TD></TR><TR><TD valign=top><IMG SRC='../images/course_map/2a.gif' width=20 height=239></TD><TD class='reg_text'><CENTER><TABLE width=500><TR><TD class='reg_text'><BR><P align=center class='title_text'>Course Map</P>";
  46.   
  47.   //list SCOS
  48.   var is_cur_sco = false;
  49.   var is_topic_done = false;
  50.   var sco_info = "";
  51.   var sco_topics = "";
  52.   var sco_topic = "";
  53.   var sco_subtopics = "";
  54.   var sco_subtopic = "";
  55.   var this_sco = "";
  56.   list_html += "<OL>";
  57.   for (var i=list_iterator(SCO_LIST); iterator_has_next(i); ) {
  58.     sco_info = iterator_next(i);
  59.     this_sco = hashtable_get(sco_info, "sco_id");
  60.     list_html += "<A name='lesson-" + this_sco + "'>";
  61.     if (CUR_SCO == this_sco) {
  62.       is_cur_sco = true;
  63.       list_html += "<LI><B>" + hashtable_get(sco_info, "title") + "</B>";
  64.     }
  65.     else  {
  66.       is_cur_sco = false;
  67.       list_html += "<LI>" + hashtable_get(sco_info, "title");
  68.     }
  69.     //if (is_cur_sco) {
  70.       list_html += "<OL type='A'>";
  71.       sco_topics = hashtable_get(sco_info, "topics");
  72.       for (var j=0; j<list_size(sco_topics); j++ ) {
  73.         sco_topic = list_get(sco_topics, j);
  74.         topic_page = hashtable_get(sco_topic, "page");
  75.         if ((is_cur_sco) && ((SCO_COMPLETE) || (parseInt(CUR_PAGE) >= parseInt(topic_page))))
  76.           list_html += "<LI><b><a href=\"javascript:load_topic('" + topic_page + "')\";>" + hashtable_get(sco_topic, "title") + "</a></b>";
  77.         else  {
  78.           if (is_cur_sco)
  79.             list_html += "<LI><b>" + hashtable_get(sco_topic, "title") + "</b>";
  80.           else
  81.             list_html += "<LI>" + hashtable_get(sco_topic, "title") + "";
  82.         }
  83.         
  84.         sco_subtopics = hashtable_get(sco_topic, "subtopics");
  85.         list_html += "<OL>";
  86.         for (var k=0; k<list_size(sco_subtopics); k++)  {
  87.           sco_subtopic = list_get(sco_subtopics, k);
  88.           list_html += "<LI>" + hashtable_get(sco_subtopic, "title");
  89.         }
  90.         list_html += "</OL>";
  91.        
  92.       }
  93.       list_html += "</OL>";
  94.     //}
  95.   }
  96.   list_html += "</OL><P align=center><A href='javascript:window.close();'>Close Window</A></P>";
  97.  
  98.   //write bottom html
  99.   list_html += "</TD></TR></TABLE></CENTER></TD></TR></TABLE>";
  100.  
  101.   document.write(list_html);
  102. }
  103.